<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Gem::SpecificationPolicy - rubygems: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="UserInteraction.html">Gem::UserInteraction</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-validate">#validate</a>
    <li ><a href="#method-i-validate_array_attribute">#validate_array_attribute</a>
    <li ><a href="#method-i-validate_array_attributes">#validate_array_attributes</a>
    <li ><a href="#method-i-validate_attribute_present">#validate_attribute_present</a>
    <li ><a href="#method-i-validate_authors_field">#validate_authors_field</a>
    <li ><a href="#method-i-validate_lazy_metadata">#validate_lazy_metadata</a>
    <li ><a href="#method-i-validate_licenses">#validate_licenses</a>
    <li ><a href="#method-i-validate_licenses_length">#validate_licenses_length</a>
    <li ><a href="#method-i-validate_metadata">#validate_metadata</a>
    <li ><a href="#method-i-validate_name">#validate_name</a>
    <li ><a href="#method-i-validate_nil_attributes">#validate_nil_attributes</a>
    <li ><a href="#method-i-validate_non_files">#validate_non_files</a>
    <li ><a href="#method-i-validate_optional">#validate_optional</a>
    <li ><a href="#method-i-validate_permissions">#validate_permissions</a>
    <li ><a href="#method-i-validate_platform">#validate_platform</a>
    <li ><a href="#method-i-validate_require_paths">#validate_require_paths</a>
    <li ><a href="#method-i-validate_required-21">#validate_required!</a>
    <li ><a href="#method-i-validate_required_attributes">#validate_required_attributes</a>
    <li ><a href="#method-i-validate_rubygems_version">#validate_rubygems_version</a>
    <li ><a href="#method-i-validate_self_inclusion_in_files_list">#validate_self_inclusion_in_files_list</a>
    <li ><a href="#method-i-validate_shebang_line_in">#validate_shebang_line_in</a>
    <li ><a href="#method-i-validate_specification_version">#validate_specification_version</a>
    <li ><a href="#method-i-validate_values">#validate_values</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Gem::SpecificationPolicy">
    <h1 id="class-Gem::SpecificationPolicy" class="class">
      class Gem::SpecificationPolicy
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="HOMEPAGE_URI_PATTERN">HOMEPAGE_URI_PATTERN
          <dd>
          <dt id="LAZY">LAZY
          <dd>
          <dt id="LAZY_PATTERN">LAZY_PATTERN
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-packaging" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">packaging</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>If set to true, run packaging-specific checks, as well.</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(specification)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">specification</span>)
  <span class="ruby-ivar">@warnings</span> = <span class="ruby-value">0</span>

  <span class="ruby-ivar">@specification</span> = <span class="ruby-identifier">specification</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-validate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate</span><span
                                class="method-args">(strict = false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Does a sanity check on the specification.</p>

<p>Raises InvalidSpecificationException if the spec does not pass the checks.</p>

<p>It also performs some validations that do not raise but print warning messages instead.</p>

                              <div class="method-source-code" id="validate-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate</span>(<span class="ruby-identifier">strict</span> = <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">validate_required!</span>

  <span class="ruby-identifier">validate_optional</span>(<span class="ruby-identifier">strict</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">packaging</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">strict</span>

  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_metadata" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_metadata</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Implementation for Specification#validate_metadata</p>

                              <div class="method-source-code" id="validate_metadata-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_metadata</span>
  <span class="ruby-identifier">metadata</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">metadata</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">metadata</span>
    <span class="ruby-identifier">error</span> <span class="ruby-string">&quot;metadata must be a hash&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">metadata</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">entry</span> = <span class="ruby-node">&quot;metadata[&#39;#{key}&#39;]&quot;</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
      <span class="ruby-identifier">error</span> <span class="ruby-string">&quot;metadata keys must be a String&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">128</span>
      <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;metadata key is too large (#{key.size} &gt; 128)&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
      <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{entry} value must be a String&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1024</span>
      <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{entry} value is too large (#{value.size} &gt; 1024)&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">METADATA_LINK_KEYS</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">key</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-constant">VALID_URI_PATTERN</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">value</span>)
      <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{entry} has invalid link: #{value.inspect}&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_optional" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_optional</span><span
                                class="method-args">(strict)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_optional-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 96</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_optional</span>(<span class="ruby-identifier">strict</span>)
  <span class="ruby-identifier">validate_licenses</span>

  <span class="ruby-identifier">validate_permissions</span>

  <span class="ruby-identifier">validate_values</span>

  <span class="ruby-identifier">validate_dependencies</span>

  <span class="ruby-identifier">validate_extensions</span>

  <span class="ruby-identifier">validate_removed_attributes</span>

  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@warnings</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">strict</span>
      <span class="ruby-identifier">error</span> <span class="ruby-string">&quot;specification has warnings&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">alert_warning</span> <span class="ruby-identifier">help_text</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_permissions" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_permissions</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Issues a warning for each file to be packaged which is world-readable.</p>

<p>Implementation for Specification#validate_permissions</p>

                              <div class="method-source-code" id="validate_permissions-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 232</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_permissions</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">win_platform?</span>

  <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">file</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">file</span>).<span class="ruby-identifier">mode</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0o444</span> <span class="ruby-operator">==</span> <span class="ruby-value">0o444</span>
    <span class="ruby-identifier">warning</span> <span class="ruby-node">&quot;#{file} is not world-readable&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">executables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">exec</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">bindir</span>, <span class="ruby-identifier">name</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">exec</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">stat</span>(<span class="ruby-identifier">exec</span>).<span class="ruby-identifier">executable?</span>
    <span class="ruby-identifier">warning</span> <span class="ruby-node">&quot;#{exec} is not executable&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_required-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_required!</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Does a sanity check on the specification.</p>

<p>Raises InvalidSpecificationException if the spec does not pass the checks.</p>

<p>Only runs checks that are considered necessary for the specification to be functional.</p>

                              <div class="method-source-code" id="validate_required-21-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 62</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_required!</span>
  <span class="ruby-identifier">validate_nil_attributes</span>

  <span class="ruby-identifier">validate_rubygems_version</span>

  <span class="ruby-identifier">validate_required_attributes</span>

  <span class="ruby-identifier">validate_name</span>

  <span class="ruby-identifier">validate_require_paths</span>

  <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">keep_only_files_and_directories</span>

  <span class="ruby-identifier">validate_non_files</span>

  <span class="ruby-identifier">validate_self_inclusion_in_files_list</span>

  <span class="ruby-identifier">validate_specification_version</span>

  <span class="ruby-identifier">validate_platform</span>

  <span class="ruby-identifier">validate_array_attributes</span>

  <span class="ruby-identifier">validate_authors_field</span>

  <span class="ruby-identifier">validate_metadata</span>

  <span class="ruby-identifier">validate_licenses_length</span>

  <span class="ruby-identifier">validate_lazy_metadata</span>

  <span class="ruby-identifier">validate_duplicate_dependencies</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-validate_array_attribute" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_array_attribute</span><span
                                class="method-args">(field)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_array_attribute-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 337</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_array_attribute</span>(<span class="ruby-identifier">field</span>)
  <span class="ruby-identifier">val</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">field</span>)
  <span class="ruby-identifier">klass</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">field</span>
          <span class="ruby-keyword">when</span> <span class="ruby-value">:dependencies</span> <span class="ruby-keyword">then</span>
            <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Dependency</span>
          <span class="ruby-keyword">else</span>
            <span class="ruby-constant">String</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">Array</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">klass</span>) <span class="ruby-operator">||</span> (<span class="ruby-identifier">field</span> <span class="ruby-operator">==</span> <span class="ruby-value">:licenses</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span>) }
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{field} must be an Array of #{klass}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_array_attributes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_array_attributes</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_array_attributes-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 331</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_array_attributes</span>
  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">array_attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">field</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">validate_array_attribute</span>(<span class="ruby-identifier">field</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_attribute_present" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_attribute_present</span><span
                                class="method-args">(attribute)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_attribute_present-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 449</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_attribute_present</span>(<span class="ruby-identifier">attribute</span>)
  <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">attribute</span>
  <span class="ruby-identifier">warning</span>(<span class="ruby-node">&quot;no #{attribute} specified&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_authors_field" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_authors_field</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_authors_field-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 351</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_authors_field</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">authors</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">error</span> <span class="ruby-string">&quot;authors may not be empty&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_lazy_metadata" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_lazy_metadata</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_lazy_metadata-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 395</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_lazy_metadata</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">authors</span>.<span class="ruby-identifier">grep</span>(<span class="ruby-constant">LAZY_PATTERN</span>).<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{LAZY} is not an author&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">Array</span>(<span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">email</span>).<span class="ruby-identifier">grep</span>(<span class="ruby-constant">LAZY_PATTERN</span>).<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{LAZY} is not an email&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">LAZY_PATTERN</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">description</span>)
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{LAZY} is not a description&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">LAZY_PATTERN</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">summary</span>)
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{LAZY} is not a summary&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">homepage</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">homepage</span>

  <span class="ruby-comment"># Make sure a homepage is valid HTTP/HTTPS URI</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">homepage</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">homepage</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;uri&quot;</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-identifier">homepage_uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">homepage</span>)
      <span class="ruby-keyword">unless</span> [<span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>, <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPS</span>].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">homepage_uri</span>.<span class="ruby-identifier">class</span>
        <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;\&quot;#{homepage}\&quot; is not a valid HTTP URI&quot;</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidURIError</span>
      <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;\&quot;#{homepage}\&quot; is not a valid HTTP URI&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_licenses" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_licenses</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_licenses-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 369</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_licenses</span>
    <span class="ruby-identifier">licenses</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">licenses</span>

    <span class="ruby-identifier">licenses</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">license</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Licenses</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">license</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">license</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">suggestions</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Licenses</span>.<span class="ruby-identifier">suggestions</span>(<span class="ruby-identifier">license</span>)
      <span class="ruby-identifier">message</span> = <span class="ruby-identifier">&lt;&lt;-WARNING</span>
<span class="ruby-value">license value &#39;#{license}&#39; is invalid.  Use a license identifier from
http://spdx.org/licenses or &#39;#{Gem::Licenses::NONSTANDARD}&#39; for a nonstandard license,
or set it to nil if you don&#39;t want to specify a license.
</span><span class="ruby-identifier">      WARNING</span>
      <span class="ruby-identifier">message</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;Did you mean #{suggestions.map {|s| &quot;&#39;#{s}&#39;&quot; }.join(&quot;, &quot;)}?\n&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">suggestions</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">warning</span>(<span class="ruby-identifier">message</span>)
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">warning</span> <span class="ruby-identifier">&lt;&lt;-WARNING</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">licenses</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-value">licenses is empty, but is recommended.  Use a license identifier from
http://spdx.org/licenses or &#39;#{Gem::Licenses::NONSTANDARD}&#39; for a nonstandard license,
or set it to nil if you don&#39;t want to specify a license.
</span><span class="ruby-identifier">    WARNING</span>
  <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_licenses_length" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_licenses_length</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_licenses_length-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 357</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_licenses_length</span>
  <span class="ruby-identifier">licenses</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">licenses</span>

  <span class="ruby-identifier">licenses</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">license</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">license</span>.<span class="ruby-identifier">nil?</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">license</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">64</span>
      <span class="ruby-identifier">error</span> <span class="ruby-string">&quot;each license must be 64 characters or less&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_name</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_name-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 277</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_name</span>
  <span class="ruby-identifier">name</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">name</span>

  <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;invalid value for attribute name: \&quot;#{name.inspect}\&quot; must be a string&quot;</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-operator">!</span><span class="ruby-regexp">/[a-zA-Z]/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">name</span>)
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;invalid value for attribute name: #{name.dump} must include at least one letter&quot;</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-operator">!</span><span class="ruby-constant">VALID_NAME_PATTERN</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">name</span>)
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;invalid value for attribute name: #{name.dump} can only include letters, numbers, dashes, and underscores&quot;</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-constant">SPECIAL_CHARACTERS</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">name</span>)
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;invalid value for attribute name: #{name.dump} can not begin with a period, dash, or underscore&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_nil_attributes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_nil_attributes</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_nil_attributes-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 251</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_nil_attributes</span>
  <span class="ruby-identifier">nil_attributes</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">non_nil_attributes</span>.<span class="ruby-identifier">select</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attrname</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">&quot;@#{attrname}&quot;</span>).<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">nil_attributes</span>.<span class="ruby-identifier">empty?</span>
  <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{nil_attributes.join &quot;, &quot;} must not be nil&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_non_files" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_non_files</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_non_files-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 297</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_non_files</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">packaging</span>

  <span class="ruby-identifier">non_files</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">files</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">x</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink?</span>(<span class="ruby-identifier">x</span>) }

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">non_files</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;[\&quot;#{non_files.join &quot;\&quot;, \&quot;&quot;}\&quot;] are not files&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_platform" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_platform</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_platform-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 321</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_platform</span>
  <span class="ruby-identifier">platform</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">platform</span>

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">platform</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Platform</span>, <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Platform</span><span class="ruby-operator">::</span><span class="ruby-constant">RUBY</span> <span class="ruby-comment"># ok</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;invalid platform #{platform.inspect}, see Gem::Platform&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_require_paths" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_require_paths</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_require_paths-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 291</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_require_paths</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">raw_require_paths</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">error</span> <span class="ruby-string">&quot;specification must have at least one require_path&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_required_attributes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_required_attributes</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_required_attributes-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 269</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_required_attributes</span>
  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">required_attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">symbol</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">symbol</span>
      <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;missing value for attribute #{symbol}&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_rubygems_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_rubygems_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_rubygems_version-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 259</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_rubygems_version</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">packaging</span>

  <span class="ruby-identifier">rubygems_version</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">rubygems_version</span>

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rubygems_version</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>

  <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;expected RubyGems version #{Gem::VERSION}, was #{rubygems_version}&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_self_inclusion_in_files_list" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_self_inclusion_in_files_list</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_self_inclusion_in_files_list-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 307</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_self_inclusion_in_files_list</span>
  <span class="ruby-identifier">file_name</span> = <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">file_name</span>

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">files</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">file_name</span>)

  <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;#{@specification.full_name} contains itself (#{file_name}), check your files list&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_shebang_line_in" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_shebang_line_in</span><span
                                class="method-args">(executable)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_shebang_line_in-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 454</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_shebang_line_in</span>(<span class="ruby-identifier">executable</span>)
  <span class="ruby-identifier">executable_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">bindir</span>, <span class="ruby-identifier">executable</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">executable_path</span>, <span class="ruby-value">2</span>) <span class="ruby-operator">==</span> <span class="ruby-string">&quot;#!&quot;</span>

  <span class="ruby-identifier">warning</span> <span class="ruby-node">&quot;#{executable_path} is missing #! line&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_specification_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_specification_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_specification_version-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 315</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_specification_version</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">specification_version</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Integer</span>)

  <span class="ruby-identifier">error</span> <span class="ruby-string">&quot;specification_version must be an Integer (did you mean version?)&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-validate_values" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">validate_values</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="validate_values-source">
            <pre><span class="ruby-comment"># File rubygems/specification_policy.rb, line 428</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_values</span>
  <span class="ruby-node">%w[author homepage summary files]</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attribute</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">validate_attribute_present</span>(<span class="ruby-identifier">attribute</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">description</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">summary</span>
    <span class="ruby-identifier">warning</span> <span class="ruby-string">&quot;description and summary are identical&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># TODO: raise at some given date</span>
  <span class="ruby-identifier">warning</span> <span class="ruby-string">&quot;deprecated autorequire specified&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">autorequire</span>

  <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">executables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">executable</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">validate_shebang_line_in</span>(<span class="ruby-identifier">executable</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@specification</span>.<span class="ruby-identifier">files</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink?</span>(<span class="ruby-identifier">f</span>) }.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">warning</span> <span class="ruby-node">&quot;#{file} is a symlink, which is not supported on all platforms&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

